#include <stdio.h>

//https://www.nowcoder.com/practice/529d3ae5a407492994ad2a246518148a?tpId=13&&tqId=11167&rp=2&ru=/activity/oj&qru=/ta/coding-interviews/question-ranking

struct ListNode {
    int val;
    struct ListNode *next;
};

struct ListNode* FindKthToTail(struct ListNode* pListHead, int k) {
    struct ListNode *fast = pListHead;
    struct ListNode *slow = pListHead;
    while (k--) {
        if (fast) {
            fast = fast->next;
        } else {
            return NULL; //如果单链表长度 < K,直接返回
        }
    }
    while (fast) {
        slow = slow->next;
        fast = fast->next;
    }
    return slow;
}